<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998


Pattern-matching constructors
-}</span><span>
</span><span id="line-8"></span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-10"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-11"></span><span class="hs-pragma">{-# LANGUAGE ViewPatterns #-}</span><span>
</span><span id="line-12"></span><span>
</span><span id="line-13"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}</span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.HsToCore.Match.Constructor</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#matchConFamily"><span class="hs-identifier">matchConFamily</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#matchPatSyn"><span class="hs-identifier">matchPatSyn</span></a></span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-20"></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.HsToCore.Match.html"><span class="hs-identifier">GHC.HsToCore.Match</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.HsToCore.Match.html#match"><span class="hs-identifier">match</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Hs.html"><span class="hs-identifier">GHC.Hs</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.HsToCore.Binds.html"><span class="hs-identifier">GHC.HsToCore.Binds</span></a></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.ConLike.html"><span class="hs-identifier">GHC.Core.ConLike</span></a></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Origin"><span class="hs-identifier">Origin</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html"><span class="hs-identifier">GHC.Tc.Utils.TcType</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Multiplicity.html"><span class="hs-identifier">GHC.Core.Multiplicity</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html"><span class="hs-identifier">GHC.HsToCore.Monad</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html"><span class="hs-identifier">GHC.HsToCore.Utils</span></a></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.html"><span class="hs-identifier">GHC.Core</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier">CoreExpr</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Make.html"><span class="hs-identifier">GHC.Core.Make</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Make.html#mkCoreLets"><span class="hs-identifier">mkCoreLets</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html"><span class="hs-identifier">GHC.Types.Name.Env</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html"><span class="hs-identifier">GHC.Types.FieldLabel</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html#flSelector"><span class="hs-identifier">flSelector</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier">liftM</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.OldList.html#groupBy"><span class="hs-identifier">groupBy</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.NonEmpty.html#"><span class="hs-identifier">Data.List.NonEmpty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#NonEmpty"><span class="hs-identifier">NonEmpty</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-42"></span><span>
</span><span id="line-43"></span><span class="hs-comment">{-
We are confronted with the first column of patterns in a set of
equations, all beginning with constructors from one ``family'' (e.g.,
@[]@ and @:@ make up the @List@ ``family'').  We want to generate the
alternatives for a @Case@ expression.  There are several choices:
\begin{enumerate}
\item
Generate an alternative for every constructor in the family, whether
they are used in this set of equations or not; this is what the Wadler
chapter does.
\begin{description}
\item[Advantages:]
(a)~Simple.  (b)~It may also be that large sparsely-used constructor
families are mainly handled by the code for literals.
\item[Disadvantages:]
(a)~Not practical for large sparsely-used constructor families, e.g.,
the ASCII character set.  (b)~Have to look up a list of what
constructors make up the whole family.
\end{description}

\item
Generate an alternative for each constructor used, then add a default
alternative in case some constructors in the family weren't used.
\begin{description}
\item[Advantages:]
(a)~Alternatives aren't generated for unused constructors.  (b)~The
STG is quite happy with defaults.  (c)~No lookup in an environment needed.
\item[Disadvantages:]
(a)~A spurious default alternative may be generated.
\end{description}

\item
``Do it right:'' generate an alternative for each constructor used,
and add a default alternative if all constructors in the family
weren't used.
\begin{description}
\item[Advantages:]
(a)~You will get cases with only one alternative (and no default),
which should be amenable to optimisation.  Tuples are a common example.
\item[Disadvantages:]
(b)~Have to look up constructor families in TDE (as above).
\end{description}
\end{enumerate}

We are implementing the ``do-it-right'' option for now.  The arguments
to @matchConFamily@ are the same as to @match@; the extra @Int@
returned is the number of constructors in the family.

The function @matchConFamily@ is concerned with this
have-we-used-all-the-constructors? question; the local function
@match_cons_used@ does all the real work.
-}</span><span>
</span><span id="line-95"></span><span>
</span><span id="line-96"></span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#matchConFamily"><span class="hs-identifier hs-type">matchConFamily</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#NonEmpty"><span class="hs-identifier hs-type">NonEmpty</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-97"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-98"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#NonEmpty"><span class="hs-identifier hs-type">NonEmpty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#NonEmpty"><span class="hs-identifier hs-type">NonEmpty</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#EquationInfo"><span class="hs-identifier hs-type">EquationInfo</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-99"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-100"></span><span class="hs-comment">-- Each group of eqns is for a single constructor</span><span>
</span><span id="line-101"></span><span id="matchConFamily"><span class="annot"><span class="annottext">matchConFamily :: NonEmpty Id
-&gt; Type
-&gt; NonEmpty (NonEmpty EquationInfo)
-&gt; DsM (MatchResult CoreExpr)
</span><a href="GHC.HsToCore.Match.Constructor.html#matchConFamily"><span class="hs-identifier hs-var hs-var">matchConFamily</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681150278"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681150278"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3A%7C"><span class="hs-operator hs-type">:|</span></a></span><span> </span><span id="local-6989586621681150276"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150276"><span class="hs-identifier hs-var">vars</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681150275"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681150275"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681150274"><span class="annot"><span class="annottext">NonEmpty (NonEmpty EquationInfo)
</span><a href="#local-6989586621681150274"><span class="hs-identifier hs-var">groups</span></a></span></span><span>
</span><span id="line-102"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681150273"><span class="annot"><span class="annottext">mult :: Type
</span><a href="#local-6989586621681150273"><span class="hs-identifier hs-var hs-var">mult</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Type
</span><a href="GHC.Types.Id.html#idMult"><span class="hs-identifier hs-var">idMult</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681150278"><span class="hs-identifier hs-var">var</span></a></span><span>
</span><span id="line-103"></span><span>           </span><span class="hs-comment">-- Each variable in the argument list correspond to one column in the</span><span>
</span><span id="line-104"></span><span>           </span><span class="hs-comment">-- pattern matching equations. Its multiplicity is the context</span><span>
</span><span id="line-105"></span><span>           </span><span class="hs-comment">-- multiplicity of the pattern. We extract that multiplicity, so that</span><span>
</span><span id="line-106"></span><span>           </span><span class="hs-comment">-- 'matchOneconLike' knows the context multiplicity, in case it needs</span><span>
</span><span id="line-107"></span><span>           </span><span class="hs-comment">-- to come up with new variables.</span><span>
</span><span id="line-108"></span><span>       </span><span id="local-6989586621681150271"><span class="annot"><span class="annottext">NonEmpty (CaseAlt DataCon)
</span><a href="#local-6989586621681150271"><span class="hs-identifier hs-var">alts</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(NonEmpty EquationInfo
 -&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt DataCon))
-&gt; NonEmpty (NonEmpty EquationInfo)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (NonEmpty (CaseAlt DataCon))
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(CaseAlt ConLike -&gt; CaseAlt DataCon)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt ConLike)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt DataCon)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">CaseAlt ConLike -&gt; CaseAlt DataCon
</span><a href="#local-6989586621681150269"><span class="hs-identifier hs-var">toRealAlt</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt ConLike)
 -&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt DataCon))
-&gt; (NonEmpty EquationInfo
    -&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt ConLike))
-&gt; NonEmpty EquationInfo
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt DataCon)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
-&gt; Type
-&gt; Type
-&gt; NonEmpty EquationInfo
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt ConLike)
</span><a href="GHC.HsToCore.Match.Constructor.html#matchOneConLike"><span class="hs-identifier hs-var">matchOneConLike</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150276"><span class="hs-identifier hs-var">vars</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681150275"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681150273"><span class="hs-identifier hs-var">mult</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">NonEmpty (NonEmpty EquationInfo)
</span><a href="#local-6989586621681150274"><span class="hs-identifier hs-var">groups</span></a></span><span>
</span><span id="line-109"></span><span>       </span><span class="annot"><span class="annottext">MatchResult CoreExpr -&gt; DsM (MatchResult CoreExpr)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Type -&gt; NonEmpty (CaseAlt DataCon) -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkCoAlgCaseMatchResult"><span class="hs-identifier hs-var">mkCoAlgCaseMatchResult</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681150278"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681150275"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">NonEmpty (CaseAlt DataCon)
</span><a href="#local-6989586621681150271"><span class="hs-identifier hs-var">alts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-110"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-111"></span><span>    </span><span id="local-6989586621681150269"><span class="annot"><span class="annottext">toRealAlt :: CaseAlt ConLike -&gt; CaseAlt DataCon
</span><a href="#local-6989586621681150269"><span class="hs-identifier hs-var hs-var">toRealAlt</span></a></span></span><span> </span><span id="local-6989586621681150265"><span class="annot"><span class="annottext">CaseAlt ConLike
</span><a href="#local-6989586621681150265"><span class="hs-identifier hs-var">alt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">CaseAlt ConLike -&gt; ConLike
forall a. CaseAlt a -&gt; a
</span><a href="GHC.HsToCore.Utils.html#alt_pat"><span class="hs-identifier hs-var hs-var">alt_pat</span></a></span><span> </span><span class="annot"><span class="annottext">CaseAlt ConLike
</span><a href="#local-6989586621681150265"><span class="hs-identifier hs-var">alt</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-112"></span><span>        </span><span class="annot"><a href="GHC.Core.ConLike.html#RealDataCon"><span class="hs-identifier hs-type">RealDataCon</span></a></span><span> </span><span id="local-6989586621681150262"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681150262"><span class="hs-identifier hs-var">dcon</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">CaseAlt ConLike
</span><a href="#local-6989586621681150265"><span class="hs-identifier hs-var">alt</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">alt_pat :: DataCon
</span><a href="GHC.HsToCore.Utils.html#alt_pat"><span class="hs-identifier hs-var">alt_pat</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681150262"><span class="hs-identifier hs-var">dcon</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-113"></span><span>        </span><span class="annot"><span class="annottext">ConLike
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; CaseAlt DataCon
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matchConFamily: not RealDataCon&quot;</span></span><span>
</span><span id="line-114"></span><span>
</span><span id="line-115"></span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#matchPatSyn"><span class="hs-identifier hs-type">matchPatSyn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#NonEmpty"><span class="hs-identifier hs-type">NonEmpty</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-116"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-117"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#NonEmpty"><span class="hs-identifier hs-type">NonEmpty</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#EquationInfo"><span class="hs-identifier hs-type">EquationInfo</span></a></span><span>
</span><span id="line-118"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-119"></span><span id="matchPatSyn"><span class="annot"><span class="annottext">matchPatSyn :: NonEmpty Id
-&gt; Type -&gt; NonEmpty EquationInfo -&gt; DsM (MatchResult CoreExpr)
</span><a href="GHC.HsToCore.Match.Constructor.html#matchPatSyn"><span class="hs-identifier hs-var hs-var">matchPatSyn</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681150260"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681150260"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3A%7C"><span class="hs-operator hs-type">:|</span></a></span><span> </span><span id="local-6989586621681150259"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150259"><span class="hs-identifier hs-var">vars</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681150258"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681150258"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681150257"><span class="annot"><span class="annottext">NonEmpty EquationInfo
</span><a href="#local-6989586621681150257"><span class="hs-identifier hs-var">eqns</span></a></span></span><span>
</span><span id="line-120"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681150256"><span class="annot"><span class="annottext">mult :: Type
</span><a href="#local-6989586621681150256"><span class="hs-identifier hs-var hs-var">mult</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Type
</span><a href="GHC.Types.Id.html#idMult"><span class="hs-identifier hs-var">idMult</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681150260"><span class="hs-identifier hs-var">var</span></a></span><span>
</span><span id="line-121"></span><span>       </span><span id="local-6989586621681150255"><span class="annot"><span class="annottext">CaseAlt PatSyn
</span><a href="#local-6989586621681150255"><span class="hs-identifier hs-var">alt</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(CaseAlt ConLike -&gt; CaseAlt PatSyn)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt ConLike)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt PatSyn)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">CaseAlt ConLike -&gt; CaseAlt PatSyn
</span><a href="#local-6989586621681150254"><span class="hs-identifier hs-var">toSynAlt</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt ConLike)
 -&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt PatSyn))
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt ConLike)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt PatSyn)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
-&gt; Type
-&gt; Type
-&gt; NonEmpty EquationInfo
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt ConLike)
</span><a href="GHC.HsToCore.Match.Constructor.html#matchOneConLike"><span class="hs-identifier hs-var">matchOneConLike</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150259"><span class="hs-identifier hs-var">vars</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681150258"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681150256"><span class="hs-identifier hs-var">mult</span></a></span><span> </span><span class="annot"><span class="annottext">NonEmpty EquationInfo
</span><a href="#local-6989586621681150257"><span class="hs-identifier hs-var">eqns</span></a></span><span>
</span><span id="line-122"></span><span>       </span><span class="annot"><span class="annottext">MatchResult CoreExpr -&gt; DsM (MatchResult CoreExpr)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Type -&gt; CaseAlt PatSyn -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkCoSynCaseMatchResult"><span class="hs-identifier hs-var">mkCoSynCaseMatchResult</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681150260"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681150258"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">CaseAlt PatSyn
</span><a href="#local-6989586621681150255"><span class="hs-identifier hs-var">alt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-123"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-124"></span><span>    </span><span id="local-6989586621681150254"><span class="annot"><span class="annottext">toSynAlt :: CaseAlt ConLike -&gt; CaseAlt PatSyn
</span><a href="#local-6989586621681150254"><span class="hs-identifier hs-var hs-var">toSynAlt</span></a></span></span><span> </span><span id="local-6989586621681150252"><span class="annot"><span class="annottext">CaseAlt ConLike
</span><a href="#local-6989586621681150252"><span class="hs-identifier hs-var">alt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">CaseAlt ConLike -&gt; ConLike
forall a. CaseAlt a -&gt; a
</span><a href="GHC.HsToCore.Utils.html#alt_pat"><span class="hs-identifier hs-var hs-var">alt_pat</span></a></span><span> </span><span class="annot"><span class="annottext">CaseAlt ConLike
</span><a href="#local-6989586621681150252"><span class="hs-identifier hs-var">alt</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-125"></span><span>        </span><span class="annot"><a href="GHC.Core.ConLike.html#PatSynCon"><span class="hs-identifier hs-type">PatSynCon</span></a></span><span> </span><span id="local-6989586621681150250"><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681150250"><span class="hs-identifier hs-var">psyn</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">CaseAlt ConLike
</span><a href="#local-6989586621681150252"><span class="hs-identifier hs-var">alt</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">alt_pat :: PatSyn
</span><a href="GHC.HsToCore.Utils.html#alt_pat"><span class="hs-identifier hs-var">alt_pat</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681150250"><span class="hs-identifier hs-var">psyn</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-126"></span><span>        </span><span class="annot"><span class="annottext">ConLike
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; CaseAlt PatSyn
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matchPatSyn: not PatSynCon&quot;</span></span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span class="hs-keyword">type</span><span> </span><span id="ConArgPats"><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#ConArgPats"><span class="hs-identifier hs-var">ConArgPats</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Hs.Type.html#HsConDetails"><span class="hs-identifier hs-type">HsConDetails</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#HsRecFields"><span class="hs-identifier hs-type">HsRecFields</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-129"></span><span>
</span><span id="line-130"></span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#matchOneConLike"><span class="hs-identifier hs-type">matchOneConLike</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-131"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-132"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Mult"><span class="hs-identifier hs-type">Mult</span></a></span><span>
</span><span id="line-133"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#NonEmpty"><span class="hs-identifier hs-type">NonEmpty</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#EquationInfo"><span class="hs-identifier hs-type">EquationInfo</span></a></span><span>
</span><span id="line-134"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Utils.html#CaseAlt"><span class="hs-identifier hs-type">CaseAlt</span></a></span><span> </span><span class="annot"><a href="GHC.Core.ConLike.html#ConLike"><span class="hs-identifier hs-type">ConLike</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-135"></span><span id="matchOneConLike"><span class="annot"><span class="annottext">matchOneConLike :: [Id]
-&gt; Type
-&gt; Type
-&gt; NonEmpty EquationInfo
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt ConLike)
</span><a href="GHC.HsToCore.Match.Constructor.html#matchOneConLike"><span class="hs-identifier hs-var hs-var">matchOneConLike</span></a></span></span><span> </span><span id="local-6989586621681150248"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150248"><span class="hs-identifier hs-var">vars</span></a></span></span><span> </span><span id="local-6989586621681150247"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681150247"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681150246"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681150246"><span class="hs-identifier hs-var">mult</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681150245"><span class="annot"><span class="annottext">EquationInfo
</span><a href="#local-6989586621681150245"><span class="hs-identifier hs-var">eqn1</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3A%7C"><span class="hs-operator hs-type">:|</span></a></span><span> </span><span id="local-6989586621681150244"><span class="annot"><span class="annottext">[EquationInfo]
</span><a href="#local-6989586621681150244"><span class="hs-identifier hs-var">eqns</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-comment">-- All eqns for a single constructor</span><span>
</span><span id="line-136"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681150243"><span class="annot"><span class="annottext">inst_tys :: [Type]
</span><a href="#local-6989586621681150243"><span class="hs-identifier hs-var hs-var">inst_tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">all</span><span> </span><span class="hs-identifier">tcIsTcTyVar</span><span> </span><span class="hs-identifier">ex_tvs</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-137"></span><span>                           </span><span class="hs-comment">-- ex_tvs can only be tyvars as data types in source</span><span>
</span><span id="line-138"></span><span>                           </span><span class="hs-comment">-- Haskell cannot mention covar yet (Aug 2018).</span><span>
</span><span id="line-139"></span><span>                         </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">tvs1</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">equalLength</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">ex_tvs</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-140"></span><span>                         </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681150233"><span class="hs-identifier hs-var">arg_tys</span></a></span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; [Type] -&gt; [Type]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [Type]
</span><a href="GHC.Core.TyCo.Rep.html#mkTyVarTys"><span class="hs-identifier hs-var">mkTyVarTys</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150235"><span class="hs-identifier hs-var">tvs1</span></a></span><span>
</span><span id="line-141"></span><span>
</span><span id="line-142"></span><span>              </span><span id="local-6989586621681150231"><span class="annot"><span class="annottext">val_arg_tys :: [Scaled Type]
</span><a href="#local-6989586621681150231"><span class="hs-identifier hs-var hs-var">val_arg_tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConLike -&gt; [Type] -&gt; [Scaled Type]
</span><a href="GHC.Core.ConLike.html#conLikeInstOrigArgTys"><span class="hs-identifier hs-var">conLikeInstOrigArgTys</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
ConLikeP GhcTc
</span><a href="#local-6989586621681150229"><span class="hs-identifier hs-var">con1</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681150243"><span class="hs-identifier hs-var">inst_tys</span></a></span><span>
</span><span id="line-143"></span><span>        </span><span class="hs-comment">-- dataConInstOrigArgTys takes the univ and existential tyvars</span><span>
</span><span id="line-144"></span><span>        </span><span class="hs-comment">-- and returns the types of the *value* args, which is what we want</span><span>
</span><span id="line-145"></span><span>
</span><span id="line-146"></span><span>              </span><span class="annot"><a href="#local-6989586621681150228"><span class="hs-identifier hs-type">match_group</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-147"></span><span>                          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#ConArgPats"><span class="hs-identifier hs-type">ConArgPats</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#EquationInfo"><span class="hs-identifier hs-type">EquationInfo</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-148"></span><span>              </span><span class="hs-comment">-- All members of the group have compatible ConArgPats</span><span>
</span><span id="line-149"></span><span>              </span><span id="local-6989586621681150228"><span class="annot"><span class="annottext">match_group :: [Id] -&gt; [(ConArgPats, EquationInfo)] -&gt; DsM (MatchResult CoreExpr)
</span><a href="#local-6989586621681150228"><span class="hs-identifier hs-var hs-var">match_group</span></a></span></span><span> </span><span id="local-6989586621681150227"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150227"><span class="hs-identifier hs-var">arg_vars</span></a></span></span><span> </span><span id="local-6989586621681150226"><span class="annot"><span class="annottext">[(ConArgPats, EquationInfo)]
</span><a href="#local-6989586621681150226"><span class="hs-identifier hs-var">arg_eqn_prs</span></a></span></span><span>
</span><span id="line-150"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">notNull</span><span> </span><span class="hs-identifier">arg_eqn_prs</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-151"></span><span>                  </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681150224"><span class="annot"><span class="annottext">[CoreExpr -&gt; CoreExpr]
</span><a href="#local-6989586621681150224"><span class="hs-identifier hs-var">wraps</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681150223"><span class="annot"><span class="annottext">[EquationInfo]
</span><a href="#local-6989586621681150223"><span class="hs-identifier hs-var">eqns'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">([(CoreExpr -&gt; CoreExpr, EquationInfo)]
 -&gt; ([CoreExpr -&gt; CoreExpr], [EquationInfo]))
-&gt; IOEnv
     (Env DsGblEnv DsLclEnv) [(CoreExpr -&gt; CoreExpr, EquationInfo)]
-&gt; IOEnv
     (Env DsGblEnv DsLclEnv) ([CoreExpr -&gt; CoreExpr], [EquationInfo])
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier hs-var">liftM</span></a></span><span> </span><span class="annot"><span class="annottext">[(CoreExpr -&gt; CoreExpr, EquationInfo)]
-&gt; ([CoreExpr -&gt; CoreExpr], [EquationInfo])
forall a b. [(a, b)] -&gt; ([a], [b])
</span><a href="../../base/src/GHC.List.html#unzip"><span class="hs-identifier hs-var">unzip</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((HsConDetails
    (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
  EquationInfo)
 -&gt; IOEnv
      (Env DsGblEnv DsLclEnv) (CoreExpr -&gt; CoreExpr, EquationInfo))
-&gt; [(HsConDetails
       (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
     EquationInfo)]
-&gt; IOEnv
     (Env DsGblEnv DsLclEnv) [(CoreExpr -&gt; CoreExpr, EquationInfo)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">(HsConDetails
   (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
 EquationInfo)
-&gt; IOEnv
     (Env DsGblEnv DsLclEnv) (CoreExpr -&gt; CoreExpr, EquationInfo)
</span><a href="#local-6989586621681150221"><span class="hs-identifier hs-var">shift</span></a></span><span> </span><span class="annot"><span class="annottext">[(HsConDetails
    (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
  EquationInfo)]
[(ConArgPats, EquationInfo)]
</span><a href="#local-6989586621681150226"><span class="hs-identifier hs-var">arg_eqn_prs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-152"></span><span>                     </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681150220"><span class="annot"><span class="annottext">group_arg_vars :: [Id]
</span><a href="#local-6989586621681150220"><span class="hs-identifier hs-var hs-var">group_arg_vars</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [(ConArgPats, EquationInfo)] -&gt; [Id]
</span><a href="#local-6989586621681150219"><span class="hs-identifier hs-var">select_arg_vars</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150227"><span class="hs-identifier hs-var">arg_vars</span></a></span><span> </span><span class="annot"><span class="annottext">[(ConArgPats, EquationInfo)]
</span><a href="#local-6989586621681150226"><span class="hs-identifier hs-var">arg_eqn_prs</span></a></span><span>
</span><span id="line-153"></span><span>                     </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681150218"><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681150218"><span class="hs-identifier hs-var">match_result</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; Type -&gt; [EquationInfo] -&gt; DsM (MatchResult CoreExpr)
</span><a href="GHC.HsToCore.Match.html#match"><span class="hs-identifier hs-var">match</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150220"><span class="hs-identifier hs-var">group_arg_vars</span></a></span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [Id] -&gt; [Id]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150248"><span class="hs-identifier hs-var">vars</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681150247"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">[EquationInfo]
</span><a href="#local-6989586621681150223"><span class="hs-identifier hs-var">eqns'</span></a></span><span>
</span><span id="line-154"></span><span>                     </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr -&gt; DsM (MatchResult CoreExpr)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(MatchResult CoreExpr -&gt; DsM (MatchResult CoreExpr))
-&gt; MatchResult CoreExpr -&gt; DsM (MatchResult CoreExpr)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">((CoreExpr -&gt; CoreExpr)
 -&gt; (CoreExpr -&gt; CoreExpr) -&gt; CoreExpr -&gt; CoreExpr)
-&gt; [CoreExpr -&gt; CoreExpr] -&gt; CoreExpr -&gt; CoreExpr
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; a -&gt; a) -&gt; t a -&gt; a
</span><a href="../../base/src/Data.Foldable.html#foldr1"><span class="hs-identifier hs-var">foldr1</span></a></span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; CoreExpr)
-&gt; (CoreExpr -&gt; CoreExpr) -&gt; CoreExpr -&gt; CoreExpr
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">(.)</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreExpr -&gt; CoreExpr]
</span><a href="#local-6989586621681150224"><span class="hs-identifier hs-var">wraps</span></a></span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; CoreExpr)
-&gt; MatchResult CoreExpr -&gt; MatchResult CoreExpr
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681150218"><span class="hs-identifier hs-var">match_result</span></a></span><span>
</span><span id="line-155"></span><span>                     </span><span class="hs-special">}</span><span>
</span><span id="line-156"></span><span>
</span><span id="line-157"></span><span>              </span><span id="local-6989586621681150221"><span class="annot"><span class="annottext">shift :: (HsConDetails
   (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
 EquationInfo)
-&gt; IOEnv
     (Env DsGblEnv DsLclEnv) (CoreExpr -&gt; CoreExpr, EquationInfo)
</span><a href="#local-6989586621681150221"><span class="hs-identifier hs-var hs-var">shift</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsConDetails
  (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc)))
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681150215"><span class="annot"><span class="annottext">eqn :: EquationInfo
</span><a href="#local-6989586621681150215"><span class="hs-identifier hs-var">eqn</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Monad.html#EqnInfo"><span class="hs-identifier hs-type">EqnInfo</span></a></span><span>
</span><span id="line-158"></span><span>                             </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">eqn_pats :: EquationInfo -&gt; [Pat GhcTc]
</span><a href="GHC.HsToCore.Monad.html#eqn_pats"><span class="hs-identifier hs-var">eqn_pats</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#ConPat"><span class="hs-identifier hs-type">ConPat</span></a></span><span>
</span><span id="line-159"></span><span>                               </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pat_args :: forall p. Pat p -&gt; HsConPatDetails p
</span><a href="GHC.Hs.Pat.html#pat_args"><span class="hs-identifier hs-var">pat_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681150210"><span class="annot"><span class="annottext">ConArgPats
</span><a href="#local-6989586621681150210"><span class="hs-identifier hs-var">args</span></a></span></span><span>
</span><span id="line-160"></span><span>                               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_con_ext :: forall p. Pat p -&gt; XConPat p
</span><a href="GHC.Hs.Pat.html#pat_con_ext"><span class="hs-identifier hs-var">pat_con_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#ConPatTc"><span class="hs-identifier hs-type">ConPatTc</span></a></span><span>
</span><span id="line-161"></span><span>                                 </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cpt_tvs :: ConPatTc -&gt; [Id]
</span><a href="GHC.Hs.Pat.html#cpt_tvs"><span class="hs-identifier hs-var">cpt_tvs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681150206"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150206"><span class="hs-identifier hs-var">tvs</span></a></span></span><span>
</span><span id="line-162"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_dicts :: ConPatTc -&gt; [Id]
</span><a href="GHC.Hs.Pat.html#cpt_dicts"><span class="hs-identifier hs-var">cpt_dicts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681150204"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150204"><span class="hs-identifier hs-var">ds</span></a></span></span><span>
</span><span id="line-163"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_binds :: ConPatTc -&gt; TcEvBinds
</span><a href="GHC.Hs.Pat.html#cpt_binds"><span class="hs-identifier hs-var">cpt_binds</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681150202"><span class="annot"><span class="annottext">TcEvBinds
</span><a href="#local-6989586621681150202"><span class="hs-identifier hs-var">bind</span></a></span></span><span>
</span><span id="line-164"></span><span>                                 </span><span class="hs-special">}</span><span>
</span><span id="line-165"></span><span>                               </span><span class="hs-special">}</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681150201"><span class="annot"><span class="annottext">[Pat GhcTc]
</span><a href="#local-6989586621681150201"><span class="hs-identifier hs-var">pats</span></a></span></span><span>
</span><span id="line-166"></span><span>                             </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-167"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681150200"><span class="annot"><span class="annottext">[CoreBind]
</span><a href="#local-6989586621681150200"><span class="hs-identifier hs-var">ds_bind</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcEvBinds -&gt; DsM [CoreBind]
</span><a href="GHC.HsToCore.Binds.html#dsTcEvBinds"><span class="hs-identifier hs-var">dsTcEvBinds</span></a></span><span> </span><span class="annot"><span class="annottext">TcEvBinds
</span><a href="#local-6989586621681150202"><span class="hs-identifier hs-var">bind</span></a></span><span>
</span><span id="line-168"></span><span>                     </span><span class="annot"><span class="annottext">(CoreExpr -&gt; CoreExpr, EquationInfo)
-&gt; IOEnv
     (Env DsGblEnv DsLclEnv) (CoreExpr -&gt; CoreExpr, EquationInfo)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">[(Id, Id)] -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#wrapBinds"><span class="hs-identifier hs-var">wrapBinds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150206"><span class="hs-identifier hs-var">tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [Id] -&gt; [(Id, Id)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-operator hs-var">`zip`</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150235"><span class="hs-identifier hs-var">tvs1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-169"></span><span>                            </span><span class="annot"><span class="annottext">(CoreExpr -&gt; CoreExpr)
-&gt; (CoreExpr -&gt; CoreExpr) -&gt; CoreExpr -&gt; CoreExpr
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, Id)] -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#wrapBinds"><span class="hs-identifier hs-var">wrapBinds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150204"><span class="hs-identifier hs-var">ds</span></a></span><span>  </span><span class="annot"><span class="annottext">[Id] -&gt; [Id] -&gt; [(Id, Id)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-operator hs-var">`zip`</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150197"><span class="hs-identifier hs-var">dicts1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-170"></span><span>                            </span><span class="annot"><span class="annottext">(CoreExpr -&gt; CoreExpr)
-&gt; (CoreExpr -&gt; CoreExpr) -&gt; CoreExpr -&gt; CoreExpr
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreBind] -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.Core.Make.html#mkCoreLets"><span class="hs-identifier hs-var">mkCoreLets</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreBind]
</span><a href="#local-6989586621681150200"><span class="hs-identifier hs-var">ds_bind</span></a></span><span>
</span><span id="line-171"></span><span>                            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">EquationInfo
</span><a href="#local-6989586621681150215"><span class="hs-identifier hs-var">eqn</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">eqn_orig :: Origin
</span><a href="GHC.HsToCore.Monad.html#eqn_orig"><span class="hs-identifier hs-var">eqn_orig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Origin
</span><a href="GHC.Types.Basic.html#Generated"><span class="hs-identifier hs-var">Generated</span></a></span><span>
</span><span id="line-172"></span><span>                                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">eqn_pats :: [Pat GhcTc]
</span><a href="GHC.HsToCore.Monad.html#eqn_pats"><span class="hs-identifier hs-var">eqn_pats</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Scaled Type] -&gt; ConArgPats -&gt; [Pat GhcTc]
</span><a href="GHC.HsToCore.Match.Constructor.html#conArgPats"><span class="hs-identifier hs-var">conArgPats</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681150231"><span class="hs-identifier hs-var">val_arg_tys</span></a></span><span> </span><span class="annot"><span class="annottext">ConArgPats
</span><a href="#local-6989586621681150210"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">[Pat GhcTc] -&gt; [Pat GhcTc] -&gt; [Pat GhcTc]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Pat GhcTc]
</span><a href="#local-6989586621681150201"><span class="hs-identifier hs-var">pats</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-173"></span><span>                            </span><span class="hs-special">)</span><span>
</span><span id="line-174"></span><span>              </span><span class="annot"><a href="#local-6989586621681150221"><span class="hs-identifier hs-var">shift</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsConDetails
  (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc)))
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Monad.html#EqnInfo"><span class="hs-identifier hs-type">EqnInfo</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">eqn_pats :: EquationInfo -&gt; [Pat GhcTc]
</span><a href="GHC.HsToCore.Monad.html#eqn_pats"><span class="hs-identifier hs-var">eqn_pats</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681150193"><span class="annot"><span class="annottext">[Pat GhcTc]
</span><a href="#local-6989586621681150193"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
-&gt; SDoc
-&gt; IOEnv
     (Env DsGblEnv DsLclEnv) (CoreExpr -&gt; CoreExpr, EquationInfo)
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matchOneCon/shift&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Pat GhcTc] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Pat GhcTc]
</span><a href="#local-6989586621681150193"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-175"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681150190"><span class="annot"><span class="annottext">scaled_arg_tys :: [Scaled Type]
</span><a href="#local-6989586621681150190"><span class="hs-identifier hs-var hs-var">scaled_arg_tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Scaled Type -&gt; Scaled Type) -&gt; [Scaled Type] -&gt; [Scaled Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; Scaled Type -&gt; Scaled Type
forall a. Type -&gt; Scaled a -&gt; Scaled a
</span><a href="GHC.Core.Multiplicity.html#scaleScaled"><span class="hs-identifier hs-var">scaleScaled</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681150246"><span class="hs-identifier hs-var">mult</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681150231"><span class="hs-identifier hs-var">val_arg_tys</span></a></span><span>
</span><span id="line-176"></span><span>            </span><span class="hs-comment">-- The 'val_arg_tys' are taken from the data type definition, they</span><span>
</span><span id="line-177"></span><span>            </span><span class="hs-comment">-- do not take into account the context multiplicity, therefore we</span><span>
</span><span id="line-178"></span><span>            </span><span class="hs-comment">-- need to scale them back to get the correct context multiplicity</span><span>
</span><span id="line-179"></span><span>            </span><span class="hs-comment">-- to desugar the sub-pattern in each field. We need to know these</span><span>
</span><span id="line-180"></span><span>            </span><span class="hs-comment">-- multiplicity because of the invariant that, in Core, binders in a</span><span>
</span><span id="line-181"></span><span>            </span><span class="hs-comment">-- constructor pattern must be scaled by the multiplicity of the</span><span>
</span><span id="line-182"></span><span>            </span><span class="hs-comment">-- case. See Note [Case expression invariants].</span><span>
</span><span id="line-183"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681150188"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150188"><span class="hs-identifier hs-var">arg_vars</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Scaled Type] -&gt; ConArgPats -&gt; DsM [Id]
</span><a href="GHC.HsToCore.Match.Constructor.html#selectConMatchVars"><span class="hs-identifier hs-var">selectConMatchVars</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681150190"><span class="hs-identifier hs-var">scaled_arg_tys</span></a></span><span> </span><span class="annot"><span class="annottext">ConArgPats
</span><a href="#local-6989586621681150186"><span class="hs-identifier hs-var">args1</span></a></span><span>
</span><span id="line-184"></span><span>                </span><span class="hs-comment">-- Use the first equation as a source of</span><span>
</span><span id="line-185"></span><span>                </span><span class="hs-comment">-- suggestions for the new variables</span><span>
</span><span id="line-186"></span><span>
</span><span id="line-187"></span><span>        </span><span class="hs-comment">-- Divide into sub-groups; see Note [Record patterns]</span><span>
</span><span id="line-188"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621681150185"><span class="hs-identifier hs-type">groups</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#ConArgPats"><span class="hs-identifier hs-type">ConArgPats</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#EquationInfo"><span class="hs-identifier hs-type">EquationInfo</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-189"></span><span>              </span><span id="local-6989586621681150185"><span class="annot"><span class="annottext">groups :: [[(ConArgPats, EquationInfo)]]
</span><a href="#local-6989586621681150185"><span class="hs-identifier hs-var hs-var">groups</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((HsConDetails
    (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
  EquationInfo)
 -&gt; (HsConDetails
       (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
     EquationInfo)
 -&gt; Bool)
-&gt; [(HsConDetails
       (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
     EquationInfo)]
-&gt; [[(HsConDetails
        (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
      EquationInfo)]]
forall a. (a -&gt; a -&gt; Bool) -&gt; [a] -&gt; [[a]]
</span><a href="../../base/src/Data.OldList.html#groupBy"><span class="hs-identifier hs-var">groupBy</span></a></span><span> </span><span class="annot"><span class="annottext">(HsConDetails
   (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
 EquationInfo)
-&gt; (HsConDetails
      (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
    EquationInfo)
-&gt; Bool
forall a. (ConArgPats, a) -&gt; (ConArgPats, a) -&gt; Bool
</span><a href="GHC.HsToCore.Match.Constructor.html#compatible_pats"><span class="hs-identifier hs-var">compatible_pats</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Pat GhcTc -&gt; ConArgPats
forall p. Pat p -&gt; HsConPatDetails p
</span><a href="GHC.Hs.Pat.html#pat_args"><span class="hs-identifier hs-var hs-var">pat_args</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">EquationInfo -&gt; Pat GhcTc
</span><a href="GHC.HsToCore.Utils.html#firstPat"><span class="hs-identifier hs-var">firstPat</span></a></span><span> </span><span class="annot"><span class="annottext">EquationInfo
</span><a href="#local-6989586621681150182"><span class="hs-identifier hs-var">eqn</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">EquationInfo
</span><a href="#local-6989586621681150182"><span class="hs-identifier hs-var">eqn</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-190"></span><span>                                               </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681150182"><span class="annot"><span class="annottext">EquationInfo
</span><a href="#local-6989586621681150182"><span class="hs-identifier hs-var">eqn</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">EquationInfo
</span><a href="#local-6989586621681150245"><span class="hs-identifier hs-var">eqn1</span></a></span><span class="annot"><span class="annottext">EquationInfo -&gt; [EquationInfo] -&gt; [EquationInfo]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[EquationInfo]
</span><a href="#local-6989586621681150244"><span class="hs-identifier hs-var">eqns</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-191"></span><span>
</span><span id="line-192"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681150181"><span class="annot"><span class="annottext">[MatchResult CoreExpr]
</span><a href="#local-6989586621681150181"><span class="hs-identifier hs-var">match_results</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">([(HsConDetails
     (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
   EquationInfo)]
 -&gt; DsM (MatchResult CoreExpr))
-&gt; [[(HsConDetails
        (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
      EquationInfo)]]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [MatchResult CoreExpr]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Id] -&gt; [(ConArgPats, EquationInfo)] -&gt; DsM (MatchResult CoreExpr)
</span><a href="#local-6989586621681150228"><span class="hs-identifier hs-var">match_group</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150188"><span class="hs-identifier hs-var">arg_vars</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[[(HsConDetails
     (Located (Pat GhcTc)) (HsRecFields GhcTc (Located (Pat GhcTc))),
   EquationInfo)]]
[[(ConArgPats, EquationInfo)]]
</span><a href="#local-6989586621681150185"><span class="hs-identifier hs-var">groups</span></a></span><span>
</span><span id="line-193"></span><span>
</span><span id="line-194"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CaseAlt ConLike -&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt ConLike)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(CaseAlt ConLike
 -&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt ConLike))
-&gt; CaseAlt ConLike
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (CaseAlt ConLike)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">MkCaseAlt :: forall a.
a -&gt; [Id] -&gt; HsWrapper -&gt; MatchResult CoreExpr -&gt; CaseAlt a
</span><a href="GHC.HsToCore.Utils.html#MkCaseAlt"><span class="hs-identifier hs-type">MkCaseAlt</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">alt_pat :: ConLike
</span><a href="GHC.HsToCore.Utils.html#alt_pat"><span class="hs-identifier hs-var">alt_pat</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConLike
ConLikeP GhcTc
</span><a href="#local-6989586621681150229"><span class="hs-identifier hs-var">con1</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-195"></span><span>                              </span><span class="annot"><span class="annottext">alt_bndrs :: [Id]
</span><a href="GHC.HsToCore.Utils.html#alt_bndrs"><span class="hs-identifier hs-var">alt_bndrs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150235"><span class="hs-identifier hs-var">tvs1</span></a></span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [Id] -&gt; [Id]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150197"><span class="hs-identifier hs-var">dicts1</span></a></span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [Id] -&gt; [Id]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150188"><span class="hs-identifier hs-var">arg_vars</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-196"></span><span>                              </span><span class="annot"><span class="annottext">alt_wrapper :: HsWrapper
</span><a href="GHC.HsToCore.Utils.html#alt_wrapper"><span class="hs-identifier hs-var">alt_wrapper</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681150177"><span class="hs-identifier hs-var">wrapper1</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-197"></span><span>                              </span><span class="annot"><span class="annottext">alt_result :: MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#alt_result"><span class="hs-identifier hs-var">alt_result</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(MatchResult CoreExpr
 -&gt; MatchResult CoreExpr -&gt; MatchResult CoreExpr)
-&gt; [MatchResult CoreExpr] -&gt; MatchResult CoreExpr
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; a -&gt; a) -&gt; t a -&gt; a
</span><a href="../../base/src/Data.Foldable.html#foldr1"><span class="hs-identifier hs-var">foldr1</span></a></span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr
-&gt; MatchResult CoreExpr -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#combineMatchResults"><span class="hs-identifier hs-var">combineMatchResults</span></a></span><span> </span><span class="annot"><span class="annottext">[MatchResult CoreExpr]
</span><a href="#local-6989586621681150181"><span class="hs-identifier hs-var">match_results</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-198"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-199"></span><span>    </span><span class="annot"><a href="GHC.Hs.Pat.html#ConPat"><span class="hs-identifier hs-type">ConPat</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pat_con :: forall p. Pat p -&gt; Located (ConLikeP p)
</span><a href="GHC.Hs.Pat.html#pat_con"><span class="hs-identifier hs-var">pat_con</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681150229"><span class="annot"><span class="annottext">ConLikeP GhcTc
</span><a href="#local-6989586621681150229"><span class="hs-identifier hs-var">con1</span></a></span></span><span>
</span><span id="line-200"></span><span>           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_args :: forall p. Pat p -&gt; HsConPatDetails p
</span><a href="GHC.Hs.Pat.html#pat_args"><span class="hs-identifier hs-var">pat_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681150186"><span class="annot"><span class="annottext">ConArgPats
</span><a href="#local-6989586621681150186"><span class="hs-identifier hs-var">args1</span></a></span></span><span>
</span><span id="line-201"></span><span>           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_con_ext :: forall p. Pat p -&gt; XConPat p
</span><a href="GHC.Hs.Pat.html#pat_con_ext"><span class="hs-identifier hs-var">pat_con_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#ConPatTc"><span class="hs-identifier hs-type">ConPatTc</span></a></span><span>
</span><span id="line-202"></span><span>             </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cpt_arg_tys :: ConPatTc -&gt; [Type]
</span><a href="GHC.Hs.Pat.html#cpt_arg_tys"><span class="hs-identifier hs-var">cpt_arg_tys</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681150233"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681150233"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span>
</span><span id="line-203"></span><span>             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_wrap :: ConPatTc -&gt; HsWrapper
</span><a href="GHC.Hs.Pat.html#cpt_wrap"><span class="hs-identifier hs-var">cpt_wrap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681150177"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681150177"><span class="hs-identifier hs-var">wrapper1</span></a></span></span><span>
</span><span id="line-204"></span><span>             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_tvs :: ConPatTc -&gt; [Id]
</span><a href="GHC.Hs.Pat.html#cpt_tvs"><span class="hs-identifier hs-var">cpt_tvs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681150235"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150235"><span class="hs-identifier hs-var">tvs1</span></a></span></span><span>
</span><span id="line-205"></span><span>             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_dicts :: ConPatTc -&gt; [Id]
</span><a href="GHC.Hs.Pat.html#cpt_dicts"><span class="hs-identifier hs-var">cpt_dicts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681150197"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150197"><span class="hs-identifier hs-var">dicts1</span></a></span></span><span>
</span><span id="line-206"></span><span>             </span><span class="hs-special">}</span><span>
</span><span id="line-207"></span><span>           </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EquationInfo -&gt; Pat GhcTc
</span><a href="GHC.HsToCore.Utils.html#firstPat"><span class="hs-identifier hs-var">firstPat</span></a></span><span> </span><span class="annot"><span class="annottext">EquationInfo
</span><a href="#local-6989586621681150245"><span class="hs-identifier hs-var">eqn1</span></a></span><span>
</span><span id="line-208"></span><span>    </span><span id="local-6989586621681150170"><span class="annot"><span class="annottext">fields1 :: [Name]
</span><a href="#local-6989586621681150170"><span class="hs-identifier hs-var hs-var">fields1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(FieldLbl Name -&gt; Name) -&gt; [FieldLbl Name] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLbl Name -&gt; Name
forall a. FieldLbl a -&gt; a
</span><a href="GHC.Types.FieldLabel.html#flSelector"><span class="hs-identifier hs-var hs-var">flSelector</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConLike -&gt; [FieldLbl Name]
</span><a href="GHC.Core.ConLike.html#conLikeFieldLabels"><span class="hs-identifier hs-var">conLikeFieldLabels</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
ConLikeP GhcTc
</span><a href="#local-6989586621681150229"><span class="hs-identifier hs-var">con1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-209"></span><span>
</span><span id="line-210"></span><span>    </span><span id="local-6989586621681150237"><span class="annot"><span class="annottext">ex_tvs :: [Id]
</span><a href="#local-6989586621681150237"><span class="hs-identifier hs-var hs-var">ex_tvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConLike -&gt; [Id]
</span><a href="GHC.Core.ConLike.html#conLikeExTyCoVars"><span class="hs-identifier hs-var">conLikeExTyCoVars</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
ConLikeP GhcTc
</span><a href="#local-6989586621681150229"><span class="hs-identifier hs-var">con1</span></a></span><span>
</span><span id="line-211"></span><span>
</span><span id="line-212"></span><span>    </span><span class="hs-comment">-- Choose the right arg_vars in the right order for this group</span><span>
</span><span id="line-213"></span><span>    </span><span class="hs-comment">-- Note [Record patterns]</span><span>
</span><span id="line-214"></span><span>    </span><span class="annot"><a href="#local-6989586621681150219"><span class="hs-identifier hs-type">select_arg_vars</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#ConArgPats"><span class="hs-identifier hs-type">ConArgPats</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#EquationInfo"><span class="hs-identifier hs-type">EquationInfo</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-215"></span><span>    </span><span id="local-6989586621681150219"><span class="annot"><span class="annottext">select_arg_vars :: [Id] -&gt; [(ConArgPats, EquationInfo)] -&gt; [Id]
</span><a href="#local-6989586621681150219"><span class="hs-identifier hs-var hs-var">select_arg_vars</span></a></span></span><span> </span><span id="local-6989586621681150167"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150167"><span class="hs-identifier hs-var">arg_vars</span></a></span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621681150166"><span class="annot"><span class="annottext">ConArgPats
</span><a href="#local-6989586621681150166"><span class="hs-identifier hs-var">arg_pats</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">EquationInfo
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[(ConArgPats, EquationInfo)]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-216"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span> </span><span id="local-6989586621681150164"><span class="annot"><span class="annottext">HsRecFields GhcTc (LPat GhcTc)
</span><a href="#local-6989586621681150164"><span class="hs-identifier hs-var">flds</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ConArgPats
</span><a href="#local-6989586621681150166"><span class="hs-identifier hs-var">arg_pats</span></a></span><span>
</span><span id="line-217"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681150163"><span class="annot"><span class="annottext">rpats :: [LHsRecField GhcTc (Located (Pat GhcTc))]
</span><a href="#local-6989586621681150163"><span class="hs-identifier hs-var hs-var">rpats</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsRecFields GhcTc (Located (Pat GhcTc))
-&gt; [LHsRecField GhcTc (Located (Pat GhcTc))]
forall p arg. HsRecFields p arg -&gt; [LHsRecField p arg]
</span><a href="GHC.Hs.Pat.html#rec_flds"><span class="hs-identifier hs-var hs-var">rec_flds</span></a></span><span> </span><span class="annot"><span class="annottext">HsRecFields GhcTc (Located (Pat GhcTc))
HsRecFields GhcTc (LPat GhcTc)
</span><a href="#local-6989586621681150164"><span class="hs-identifier hs-var">flds</span></a></span><span>
</span><span id="line-218"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[LHsRecField GhcTc (Located (Pat GhcTc))] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsRecField GhcTc (Located (Pat GhcTc))]
</span><a href="#local-6989586621681150163"><span class="hs-identifier hs-var">rpats</span></a></span><span class="hs-special">)</span><span>     </span><span class="hs-comment">-- Treated specially; cf conArgPats</span><span>
</span><span id="line-219"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">fields1</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">equalLength</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">arg_vars</span><span class="hs-special">,</span><span>
</span><span id="line-220"></span><span>                 </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">con1</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">fields1</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">arg_vars</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-221"></span><span>        </span><span class="annot"><span class="annottext">(LHsRecField GhcTc (Located (Pat GhcTc)) -&gt; Id)
-&gt; [LHsRecField GhcTc (Located (Pat GhcTc))] -&gt; [Id]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LHsRecField GhcTc (Located (Pat GhcTc)) -&gt; Id
</span><a href="#local-6989586621681150158"><span class="hs-identifier hs-var">lookup_fld</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsRecField GhcTc (Located (Pat GhcTc))]
</span><a href="#local-6989586621681150163"><span class="hs-identifier hs-var">rpats</span></a></span><span>
</span><span id="line-222"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-223"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150167"><span class="hs-identifier hs-var">arg_vars</span></a></span><span>
</span><span id="line-224"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-225"></span><span>        </span><span id="local-6989586621681150157"><span class="annot"><span class="annottext">fld_var_env :: NameEnv Id
</span><a href="#local-6989586621681150157"><span class="hs-identifier hs-var hs-var">fld_var_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Name, Id)] -&gt; NameEnv Id
forall a. [(Name, a)] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#mkNameEnv"><span class="hs-identifier hs-var">mkNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">([(Name, Id)] -&gt; NameEnv Id) -&gt; [(Name, Id)] -&gt; NameEnv Id
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; [Name] -&gt; [Id] -&gt; [(Name, Id)]
forall a b. String -&gt; [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="GHC.Utils.Misc.html#zipEqual"><span class="hs-identifier hs-var">zipEqual</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;get_arg_vars&quot;</span></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681150170"><span class="hs-identifier hs-var">fields1</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681150167"><span class="hs-identifier hs-var">arg_vars</span></a></span><span>
</span><span id="line-226"></span><span>        </span><span id="local-6989586621681150158"><span class="annot"><span class="annottext">lookup_fld :: LHsRecField GhcTc (Located (Pat GhcTc)) -&gt; Id
</span><a href="#local-6989586621681150158"><span class="hs-identifier hs-var hs-var">lookup_fld</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681150154"><span class="annot"><span class="annottext">HsRecField GhcTc (Located (Pat GhcTc))
</span><a href="#local-6989586621681150154"><span class="hs-identifier hs-var">rpat</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameEnv Id -&gt; Name -&gt; Id
forall a. NameEnv a -&gt; Name -&gt; a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv_NF"><span class="hs-identifier hs-var">lookupNameEnv_NF</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv Id
</span><a href="#local-6989586621681150157"><span class="hs-identifier hs-var">fld_var_env</span></a></span><span>
</span><span id="line-227"></span><span>                                            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan Id -&gt; Id
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsRecField GhcTc (Located (Pat GhcTc)) -&gt; GenLocated SrcSpan Id
forall arg. HsRecField GhcTc arg -&gt; GenLocated SrcSpan Id
</span><a href="GHC.Hs.Pat.html#hsRecFieldId"><span class="hs-identifier hs-var">hsRecFieldId</span></a></span><span> </span><span class="annot"><span class="annottext">HsRecField GhcTc (Located (Pat GhcTc))
</span><a href="#local-6989586621681150154"><span class="hs-identifier hs-var">rpat</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-228"></span><span>    </span><span class="annot"><a href="#local-6989586621681150219"><span class="hs-identifier hs-var">select_arg_vars</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [Id]
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matchOneCon/select_arg_vars []&quot;</span></span><span>
</span><span id="line-229"></span><span>
</span><span id="line-230"></span><span class="hs-comment">-----------------</span><span>
</span><span id="line-231"></span><span id="local-6989586621681150384"><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#compatible_pats"><span class="hs-identifier hs-type">compatible_pats</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#ConArgPats"><span class="hs-identifier hs-type">ConArgPats</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621681150384"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#ConArgPats"><span class="hs-identifier hs-type">ConArgPats</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621681150384"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-232"></span><span class="hs-comment">-- Two constructors have compatible argument patterns if the number</span><span>
</span><span id="line-233"></span><span class="hs-comment">-- and order of sub-matches is the same in both cases</span><span>
</span><span id="line-234"></span><span id="compatible_pats"><span class="annot"><span class="annottext">compatible_pats :: forall a. (ConArgPats, a) -&gt; (ConArgPats, a) -&gt; Bool
</span><a href="GHC.HsToCore.Match.Constructor.html#compatible_pats"><span class="hs-identifier hs-var hs-var">compatible_pats</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span> </span><span id="local-6989586621681150147"><span class="annot"><span class="annottext">HsRecFields GhcTc (LPat GhcTc)
</span><a href="#local-6989586621681150147"><span class="hs-identifier hs-var">flds1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span> </span><span id="local-6989586621681150146"><span class="annot"><span class="annottext">HsRecFields GhcTc (LPat GhcTc)
</span><a href="#local-6989586621681150146"><span class="hs-identifier hs-var">flds2</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsRecFields GhcTc (LPat GhcTc)
-&gt; HsRecFields GhcTc (LPat GhcTc) -&gt; Bool
</span><a href="GHC.HsToCore.Match.Constructor.html#same_fields"><span class="hs-identifier hs-var">same_fields</span></a></span><span> </span><span class="annot"><span class="annottext">HsRecFields GhcTc (LPat GhcTc)
</span><a href="#local-6989586621681150147"><span class="hs-identifier hs-var">flds1</span></a></span><span> </span><span class="annot"><span class="annottext">HsRecFields GhcTc (LPat GhcTc)
</span><a href="#local-6989586621681150146"><span class="hs-identifier hs-var">flds2</span></a></span><span>
</span><span id="line-235"></span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#compatible_pats"><span class="hs-identifier hs-var">compatible_pats</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span> </span><span id="local-6989586621681150144"><span class="annot"><span class="annottext">HsRecFields GhcTc (LPat GhcTc)
</span><a href="#local-6989586621681150144"><span class="hs-identifier hs-var">flds1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(ConArgPats, a)
</span><span class="hs-identifier">_</span></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LHsRecField GhcTc (Located (Pat GhcTc))] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsRecFields GhcTc (Located (Pat GhcTc))
-&gt; [LHsRecField GhcTc (Located (Pat GhcTc))]
forall p arg. HsRecFields p arg -&gt; [LHsRecField p arg]
</span><a href="GHC.Hs.Pat.html#rec_flds"><span class="hs-identifier hs-var hs-var">rec_flds</span></a></span><span> </span><span class="annot"><span class="annottext">HsRecFields GhcTc (Located (Pat GhcTc))
HsRecFields GhcTc (LPat GhcTc)
</span><a href="#local-6989586621681150144"><span class="hs-identifier hs-var">flds1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-236"></span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#compatible_pats"><span class="hs-identifier hs-var">compatible_pats</span></a></span><span> </span><span class="annot"><span class="annottext">(ConArgPats, a)
</span><span class="hs-identifier">_</span></span><span>                 </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span> </span><span id="local-6989586621681150143"><span class="annot"><span class="annottext">HsRecFields GhcTc (LPat GhcTc)
</span><a href="#local-6989586621681150143"><span class="hs-identifier hs-var">flds2</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LHsRecField GhcTc (Located (Pat GhcTc))] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsRecFields GhcTc (Located (Pat GhcTc))
-&gt; [LHsRecField GhcTc (Located (Pat GhcTc))]
forall p arg. HsRecFields p arg -&gt; [LHsRecField p arg]
</span><a href="GHC.Hs.Pat.html#rec_flds"><span class="hs-identifier hs-var hs-var">rec_flds</span></a></span><span> </span><span class="annot"><span class="annottext">HsRecFields GhcTc (Located (Pat GhcTc))
HsRecFields GhcTc (LPat GhcTc)
</span><a href="#local-6989586621681150143"><span class="hs-identifier hs-var">flds2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-237"></span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#compatible_pats"><span class="hs-identifier hs-var">compatible_pats</span></a></span><span> </span><span class="annot"><span class="annottext">(ConArgPats, a)
</span><span class="hs-identifier">_</span></span><span>                 </span><span class="annot"><span class="annottext">(ConArgPats, a)
</span><span class="hs-identifier">_</span></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-comment">-- Prefix or infix con</span><span>
</span><span id="line-238"></span><span>
</span><span id="line-239"></span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#same_fields"><span class="hs-identifier hs-type">same_fields</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#HsRecFields"><span class="hs-identifier hs-type">HsRecFields</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#HsRecFields"><span class="hs-identifier hs-type">HsRecFields</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-240"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-241"></span><span id="same_fields"><span class="annot"><span class="annottext">same_fields :: HsRecFields GhcTc (LPat GhcTc)
-&gt; HsRecFields GhcTc (LPat GhcTc) -&gt; Bool
</span><a href="GHC.HsToCore.Match.Constructor.html#same_fields"><span class="hs-identifier hs-var hs-var">same_fields</span></a></span></span><span> </span><span id="local-6989586621681150142"><span class="annot"><span class="annottext">HsRecFields GhcTc (LPat GhcTc)
</span><a href="#local-6989586621681150142"><span class="hs-identifier hs-var">flds1</span></a></span></span><span> </span><span id="local-6989586621681150141"><span class="annot"><span class="annottext">HsRecFields GhcTc (LPat GhcTc)
</span><a href="#local-6989586621681150141"><span class="hs-identifier hs-var">flds2</span></a></span></span><span>
</span><span id="line-242"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LHsRecField GhcTc (Located (Pat GhcTc))
 -&gt; LHsRecField GhcTc (Located (Pat GhcTc)) -&gt; Bool)
-&gt; [LHsRecField GhcTc (Located (Pat GhcTc))]
-&gt; [LHsRecField GhcTc (Located (Pat GhcTc))]
-&gt; Bool
forall a b. (a -&gt; b -&gt; Bool) -&gt; [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#all2"><span class="hs-identifier hs-var">all2</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681150139"><span class="annot"><span class="annottext">HsRecField GhcTc (Located (Pat GhcTc))
</span><a href="#local-6989586621681150139"><span class="hs-identifier hs-var">f1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681150138"><span class="annot"><span class="annottext">HsRecField GhcTc (Located (Pat GhcTc))
</span><a href="#local-6989586621681150138"><span class="hs-identifier hs-var">f2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-243"></span><span>                          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan Id -&gt; Id
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsRecField GhcTc (Located (Pat GhcTc)) -&gt; GenLocated SrcSpan Id
forall arg. HsRecField GhcTc arg -&gt; GenLocated SrcSpan Id
</span><a href="GHC.Hs.Pat.html#hsRecFieldId"><span class="hs-identifier hs-var">hsRecFieldId</span></a></span><span> </span><span class="annot"><span class="annottext">HsRecField GhcTc (Located (Pat GhcTc))
</span><a href="#local-6989586621681150139"><span class="hs-identifier hs-var">f1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Id -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan Id -&gt; Id
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsRecField GhcTc (Located (Pat GhcTc)) -&gt; GenLocated SrcSpan Id
forall arg. HsRecField GhcTc arg -&gt; GenLocated SrcSpan Id
</span><a href="GHC.Hs.Pat.html#hsRecFieldId"><span class="hs-identifier hs-var">hsRecFieldId</span></a></span><span> </span><span class="annot"><span class="annottext">HsRecField GhcTc (Located (Pat GhcTc))
</span><a href="#local-6989586621681150138"><span class="hs-identifier hs-var">f2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-244"></span><span>         </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsRecFields GhcTc (Located (Pat GhcTc))
-&gt; [LHsRecField GhcTc (Located (Pat GhcTc))]
forall p arg. HsRecFields p arg -&gt; [LHsRecField p arg]
</span><a href="GHC.Hs.Pat.html#rec_flds"><span class="hs-identifier hs-var hs-var">rec_flds</span></a></span><span> </span><span class="annot"><span class="annottext">HsRecFields GhcTc (Located (Pat GhcTc))
HsRecFields GhcTc (LPat GhcTc)
</span><a href="#local-6989586621681150142"><span class="hs-identifier hs-var">flds1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsRecFields GhcTc (Located (Pat GhcTc))
-&gt; [LHsRecField GhcTc (Located (Pat GhcTc))]
forall p arg. HsRecFields p arg -&gt; [LHsRecField p arg]
</span><a href="GHC.Hs.Pat.html#rec_flds"><span class="hs-identifier hs-var hs-var">rec_flds</span></a></span><span> </span><span class="annot"><span class="annottext">HsRecFields GhcTc (Located (Pat GhcTc))
HsRecFields GhcTc (LPat GhcTc)
</span><a href="#local-6989586621681150141"><span class="hs-identifier hs-var">flds2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-245"></span><span>
</span><span id="line-246"></span><span>
</span><span id="line-247"></span><span class="hs-comment">-----------------</span><span>
</span><span id="line-248"></span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#selectConMatchVars"><span class="hs-identifier hs-type">selectConMatchVars</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#ConArgPats"><span class="hs-identifier hs-type">ConArgPats</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-249"></span><span id="selectConMatchVars"><span class="annot"><span class="annottext">selectConMatchVars :: [Scaled Type] -&gt; ConArgPats -&gt; DsM [Id]
</span><a href="GHC.HsToCore.Match.Constructor.html#selectConMatchVars"><span class="hs-identifier hs-var hs-var">selectConMatchVars</span></a></span></span><span> </span><span id="local-6989586621681150137"><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681150137"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span> </span><span id="local-6989586621681150136"><span class="annot"><span class="annottext">ConArgPats
</span><a href="#local-6989586621681150136"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ConArgPats
</span><a href="#local-6989586621681150136"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-250"></span><span>                                   </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Scaled Type] -&gt; DsM [Id]
</span><a href="GHC.HsToCore.Monad.html#newSysLocalsDsNoLP"><span class="hs-identifier hs-var">newSysLocalsDsNoLP</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681150137"><span class="hs-identifier hs-var">arg_tys</span></a></span><span>
</span><span id="line-251"></span><span>                                   </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#PrefixCon"><span class="hs-identifier hs-type">PrefixCon</span></a></span><span> </span><span id="local-6989586621681150133"><span class="annot"><span class="annottext">[LPat GhcTc]
</span><a href="#local-6989586621681150133"><span class="hs-identifier hs-var">ps</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[(Type, Pat GhcTc)] -&gt; DsM [Id]
</span><a href="GHC.HsToCore.Utils.html#selectMatchVars"><span class="hs-identifier hs-var">selectMatchVars</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Scaled Type] -&gt; [Located (Pat GhcTc)] -&gt; [(Type, Pat GhcTc)]
forall {a} {l} {b}. [Scaled a] -&gt; [GenLocated l b] -&gt; [(Type, b)]
</span><a href="#local-6989586621681150131"><span class="hs-identifier hs-var">zipMults</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681150137"><span class="hs-identifier hs-var">arg_tys</span></a></span><span> </span><span class="annot"><span class="annottext">[Located (Pat GhcTc)]
[LPat GhcTc]
</span><a href="#local-6989586621681150133"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-252"></span><span>                                   </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#InfixCon"><span class="hs-identifier hs-type">InfixCon</span></a></span><span> </span><span id="local-6989586621681150129"><span class="annot"><span class="annottext">LPat GhcTc
</span><a href="#local-6989586621681150129"><span class="hs-identifier hs-var">p1</span></a></span></span><span> </span><span id="local-6989586621681150128"><span class="annot"><span class="annottext">LPat GhcTc
</span><a href="#local-6989586621681150128"><span class="hs-identifier hs-var">p2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[(Type, Pat GhcTc)] -&gt; DsM [Id]
</span><a href="GHC.HsToCore.Utils.html#selectMatchVars"><span class="hs-identifier hs-var">selectMatchVars</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Scaled Type] -&gt; [Located (Pat GhcTc)] -&gt; [(Type, Pat GhcTc)]
forall {a} {l} {b}. [Scaled a] -&gt; [GenLocated l b] -&gt; [(Type, b)]
</span><a href="#local-6989586621681150131"><span class="hs-identifier hs-var">zipMults</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681150137"><span class="hs-identifier hs-var">arg_tys</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Located (Pat GhcTc)
LPat GhcTc
</span><a href="#local-6989586621681150129"><span class="hs-identifier hs-var">p1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc)
LPat GhcTc
</span><a href="#local-6989586621681150128"><span class="hs-identifier hs-var">p2</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-253"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-254"></span><span>    </span><span id="local-6989586621681150131"><span class="annot"><span class="annottext">zipMults :: [Scaled a] -&gt; [GenLocated l b] -&gt; [(Type, b)]
</span><a href="#local-6989586621681150131"><span class="hs-identifier hs-var hs-var">zipMults</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
-&gt; (Scaled a -&gt; GenLocated l b -&gt; (Type, b))
-&gt; [Scaled a]
-&gt; [GenLocated l b]
-&gt; [(Type, b)]
forall a b c. String -&gt; (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="GHC.Utils.Misc.html#zipWithEqual"><span class="hs-identifier hs-var">zipWithEqual</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;selectConMatchVar&quot;</span></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681150126"><span class="annot"><span class="annottext">Scaled a
</span><a href="#local-6989586621681150126"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621681150125"><span class="annot"><span class="annottext">GenLocated l b
</span><a href="#local-6989586621681150125"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled a -&gt; Type
forall a. Scaled a -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#scaledMult"><span class="hs-identifier hs-var">scaledMult</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled a
</span><a href="#local-6989586621681150126"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">GenLocated l b -&gt; b
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated l b
</span><a href="#local-6989586621681150125"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-255"></span><span>
</span><span id="line-256"></span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#conArgPats"><span class="hs-identifier hs-type">conArgPats</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-comment">-- Instantiated argument types</span><span>
</span><span id="line-257"></span><span>                          </span><span class="hs-comment">-- Used only to fill in the types of WildPats, which</span><span>
</span><span id="line-258"></span><span>                          </span><span class="hs-comment">-- are probably never looked at anyway</span><span>
</span><span id="line-259"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#ConArgPats"><span class="hs-identifier hs-type">ConArgPats</span></a></span><span>
</span><span id="line-260"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-261"></span><span id="conArgPats"><span class="annot"><span class="annottext">conArgPats :: [Scaled Type] -&gt; ConArgPats -&gt; [Pat GhcTc]
</span><a href="GHC.HsToCore.Match.Constructor.html#conArgPats"><span class="hs-identifier hs-var hs-var">conArgPats</span></a></span></span><span> </span><span id="local-6989586621681150123"><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681150123"><span class="hs-identifier hs-var">_arg_tys</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#PrefixCon"><span class="hs-identifier hs-type">PrefixCon</span></a></span><span> </span><span id="local-6989586621681150122"><span class="annot"><span class="annottext">[LPat GhcTc]
</span><a href="#local-6989586621681150122"><span class="hs-identifier hs-var">ps</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Located (Pat GhcTc) -&gt; Pat GhcTc)
-&gt; [Located (Pat GhcTc)] -&gt; [Pat GhcTc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc) -&gt; Pat GhcTc
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">[Located (Pat GhcTc)]
[LPat GhcTc]
</span><a href="#local-6989586621681150122"><span class="hs-identifier hs-var">ps</span></a></span><span>
</span><span id="line-262"></span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#conArgPats"><span class="hs-identifier hs-var">conArgPats</span></a></span><span> </span><span id="local-6989586621681150121"><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681150121"><span class="hs-identifier hs-var">_arg_tys</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#InfixCon"><span class="hs-identifier hs-type">InfixCon</span></a></span><span> </span><span id="local-6989586621681150120"><span class="annot"><span class="annottext">LPat GhcTc
</span><a href="#local-6989586621681150120"><span class="hs-identifier hs-var">p1</span></a></span></span><span> </span><span id="local-6989586621681150119"><span class="annot"><span class="annottext">LPat GhcTc
</span><a href="#local-6989586621681150119"><span class="hs-identifier hs-var">p2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Located (Pat GhcTc) -&gt; Pat GhcTc
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc)
LPat GhcTc
</span><a href="#local-6989586621681150120"><span class="hs-identifier hs-var">p1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc) -&gt; Pat GhcTc
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcTc)
LPat GhcTc
</span><a href="#local-6989586621681150119"><span class="hs-identifier hs-var">p2</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-263"></span><span class="annot"><a href="GHC.HsToCore.Match.Constructor.html#conArgPats"><span class="hs-identifier hs-var">conArgPats</span></a></span><span>  </span><span id="local-6989586621681150118"><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681150118"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#HsRecFields"><span class="hs-identifier hs-type">HsRecFields</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">rec_flds :: forall p arg. HsRecFields p arg -&gt; [LHsRecField p arg]
</span><a href="GHC.Hs.Pat.html#rec_flds"><span class="hs-identifier hs-var">rec_flds</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681150116"><span class="annot"><span class="annottext">[LHsRecField GhcTc (LPat GhcTc)]
</span><a href="#local-6989586621681150116"><span class="hs-identifier hs-var">rpats</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-264"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[LHsRecField GhcTc (Located (Pat GhcTc))] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsRecField GhcTc (Located (Pat GhcTc))]
[LHsRecField GhcTc (LPat GhcTc)]
</span><a href="#local-6989586621681150116"><span class="hs-identifier hs-var">rpats</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Pat GhcTc) -&gt; [Type] -&gt; [Pat GhcTc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Pat GhcTc
forall p. XWildPat p -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#WildPat"><span class="hs-identifier hs-var">WildPat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Scaled Type -&gt; Type) -&gt; [Scaled Type] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled Type -&gt; Type
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681150118"><span class="hs-identifier hs-var">arg_tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-265"></span><span>        </span><span class="hs-comment">-- Important special case for C {}, which can be used for a</span><span>
</span><span id="line-266"></span><span>        </span><span class="hs-comment">-- datacon that isn't declared to have fields at all</span><span>
</span><span id="line-267"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LHsRecField GhcTc (Located (Pat GhcTc)) -&gt; Pat GhcTc)
-&gt; [LHsRecField GhcTc (Located (Pat GhcTc))] -&gt; [Pat GhcTc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located (Pat GhcTc) -&gt; Pat GhcTc
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">(Located (Pat GhcTc) -&gt; Pat GhcTc)
-&gt; (LHsRecField GhcTc (Located (Pat GhcTc)) -&gt; Located (Pat GhcTc))
-&gt; LHsRecField GhcTc (Located (Pat GhcTc))
-&gt; Pat GhcTc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">HsRecField GhcTc (Located (Pat GhcTc)) -&gt; Located (Pat GhcTc)
forall id arg. HsRecField' id arg -&gt; arg
</span><a href="GHC.Hs.Pat.html#hsRecFieldArg"><span class="hs-identifier hs-var hs-var">hsRecFieldArg</span></a></span><span> </span><span class="annot"><span class="annottext">(HsRecField GhcTc (Located (Pat GhcTc)) -&gt; Located (Pat GhcTc))
-&gt; (LHsRecField GhcTc (Located (Pat GhcTc))
    -&gt; HsRecField GhcTc (Located (Pat GhcTc)))
-&gt; LHsRecField GhcTc (Located (Pat GhcTc))
-&gt; Located (Pat GhcTc)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LHsRecField GhcTc (Located (Pat GhcTc))
-&gt; HsRecField GhcTc (Located (Pat GhcTc))
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LHsRecField GhcTc (Located (Pat GhcTc))]
[LHsRecField GhcTc (LPat GhcTc)]
</span><a href="#local-6989586621681150116"><span class="hs-identifier hs-var">rpats</span></a></span><span>
</span><span id="line-268"></span><span>
</span><span id="line-269"></span><span class="hs-comment">{-
Note [Record patterns]
~~~~~~~~~~~~~~~~~~~~~~
Consider
         data T = T { x,y,z :: Bool }

         f (T { y=True, x=False }) = ...

We must match the patterns IN THE ORDER GIVEN, thus for the first
one we match y=True before x=False.  See #246; or imagine
matching against (T { y=False, x=undefined }): should fail without
touching the undefined.

Now consider:

         f (T { y=True, x=False }) = ...
         f (T { x=True, y= False}) = ...

In the first we must test y first; in the second we must test x
first.  So we must divide even the equations for a single constructor
T into sub-groups, based on whether they match the same field in the
same order.  That's what the (groupBy compatible_pats) grouping.

All non-record patterns are &quot;compatible&quot; in this sense, because the
positional patterns (T a b) and (a `T` b) all match the arguments
in order.  Also T {} is special because it's equivalent to (T _ _).
Hence the (null rpats) checks here and there.

-}</span><span>
</span><span id="line-298"></span></pre></body></html>